import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';

export interface DragData{
  tag:string;// 区分那一级 拖拽
  data:any; // 数据
}

@Injectable()
export class DragDrapService {

  // BehaviorSubject  总能记住 上一次的值
  private _draData = new BehaviorSubject<DragData | null>(null);
  setDragData(data:DragData){
    this._draData.next(data);
  }

  getDragData():Observable<DragData>{
    return this._draData.asObservable();
  }

  // 清空数据
  clearDragData(){
    this._draData.next(null)
  }
}
